<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function add(){
				var num1=document.getElementById("num1").value
				var num2=document.getElementById("num2").value
				if(isNaN(num1) || isNaN(num2)){
					alert("请输入数字")
					return
				}				
				document.getElementById("num3").value=((num1-0)+(num2-0)).toFixed(16)-0;
			}
			function sub(){
				var num1=document.getElementById("num1").value
				var num2=document.getElementById("num2").value
				document.getElementById("num3").value=num1-num2
			}
			function mul(){
				var num1=document.getElementById("num1").value
				var num2=document.getElementById("num2").value
				document.getElementById("num3").value=num1*num2
			}
			function div(){
				var num1=document.getElementById("num1").value
				var num2=document.getElementById("num2").value
				document.getElementById("num3").value=num1/num2
			}
		</script>
	</head>
	<body>
		第一个数：<input type="text"  id="num1"  /><br>
		第二个数：<input type="text"  id="num2"  /><br>
		<button onclick="add()">+</button>
		<button onclick="sub()">-</button>
		<button onclick="mul()">*</button>
		<button onclick="div()">/</button><br>
		计算结果：<input type="text"  id="num3"  /><br>
		
		<div style="width: 100px;"></div>
	</body>
</html>
